# -*- encoding: utf-8 -*-
'''
@File    :   1.17_7.py
@Time    :   2022/11/01 13:23:43
@Author  :   Cms 
@Version :   1.0
@Contact :   2267000140@qq.com
@WebSite    :   www.baidu.com
'''

# here put the import lib
import pickle
# 给定一个字典,保存了5个同学的学号,姓名,年龄;使用pickle模块将数据对象保存到文件中去

data1 = {'101': ('小张', 18),
         '102': ('小王', 20),
         '103': ('小李', 19),
         '104': ('小陈', 21),
         '105': ('小刘', 22)}
selfref_list = [1, 2, 3]
selfref_list.append(selfref_list)

output = open('data.pkl', 'wb')

# Pickle dictionary using protocol 0.
pickle.dump(data1, output)

# Pickle the list using the highest protocol available.
pickle.dump(selfref_list, output, -1)

output.close()
